<template>
  <div class="sunny-zee-doc">
    <aside>
      <router-link v-for="(link, index) in data.links" :key="index" :to="link.path">{{ link.name }}</router-link>
    </aside>
    <main>
      <router-view></router-view>
    </main>
  </div>
</template>

<script setup>
import ComponentList from 'packages/list.json';
import { reactive } from 'vue'

const data = reactive({
  links: ComponentList.map(item => ({
    path: `/components/${item.compName}`,
    name: item.compZhName
  }))
})
</script>

<style lang="less">
html,
body {
  margin: 0;
  padding: 0;
}
.sunny-zee-doc {
  display: flex;
  min-height: 100vh;
  aside {
    width: 200px;
    padding: 15px;
    border-right: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    overflow: auto;
    height: 100vh;
    position: fixed;
    a{
      font-size: 12px;
      font-weight: normal;
      color: #666;
      &.router-link-active.router-link-exact-active{
        color: #42B983;
      }
    }
  }
  main {
    width: 100%;
    margin-left: 230px;
    flex: 1;
    padding: 15px;
  }
}

// 滚动条整体宽度
::-webkit-scrollbar {
  width: 8px;
}
// 滚动条滑槽样式
::-webkit-scrollbar-track {
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.2);
  border-radius: 8px;
} 
// 滚动条样式
::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: #ddd;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}
::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}
::-webkit-scrollbar-thumb:active {
  background: #999;
} 
// 浏览器失焦的样式
::-webkit-scrollbar-thumb:window-inactive {
  background: inset 0 0 6px rgba(0, 0, 0, 0.3);
}
</style>